enum WebEvent {
    PageLoad,
    PageUnload,
    KeyPress(char),
    Paste(String),
    Click { x: i64, y: i64 },
}

impl WebEvent {
    fn inspect(&self) {
        match self {
            Self::PageLoad => println!("page load"),
            Self::PageUnload => println!("page un load"),
            Self::KeyPress(c) => println!("pressed '{}'", c),
            Self::Paste(str) => println!("pasted \" {} \" ", str),
            Self::Click { x, y } => println!("clicked at x={} y={}", x, y)
        }
    }
}


fn main() {
    println!("Hello, world!");
    let pressed = WebEvent::KeyPress('x');
    let pasted = WebEvent::Paste("xyz".to_owned());
    let click = WebEvent::Click { x: 20, y: 30 };
    let load = WebEvent::PageLoad;
    let unload = WebEvent::PageUnload;
    pressed.inspect();
    pasted.inspect();
    click.inspect();
    load.inspect();
    unload.inspect();
}
